home *** CD-ROM | disk | FTP | other *** search
/ Hacker's Arsenal - The Cutting Edge of Hacking / Hacker's Arsenal - The Cutting Edge of Hacking.iso / texts / hacking-intro.txt < prev    next >
Text File  |  2001-07-11  |  7KB  |  162 lines

  1.              |+=================================+|
  2.              ||*********************************||
  3.              ||*    Introduction to Hacking    *||
  4.              ||*     by KwAnTAM_PoZeEtroN      *||
  5.              ||*********************************||
  6.              |+=================================+|
  7.  
  8. The first part of any hacking expidition is getting into the system
  9. that you plan to 'explore.'  This can be achieved in any number of 
  10. ways.  The main two are:
  11.  
  12. 1) Cracking passwd (brute force)
  13. 2) Using an exploit
  14.  
  15. Cracking passwd is fairly simple.  You get a 'cracking' program which 
  16. is designed to take each word in a word list file and encrypt it 
  17. using the same one-way hash that UNIX uses to encrypt its password 
  18. file.  Then it compares the hashed value to each password in the 
  19. encrypted list, which is found on UNIX and other *IX systems in the 
  20. file /etc/passwd  Word lists and cracking programs are available at
  21. http://kwantam.home.ml.org
  22.  
  23. The list of words used is called a dictionary file.  It contains a 
  24. series of words, one per line, in a standard ASCII text file.  An 
  25. excerpt from a dictionary file could be
  26.  
  27. helix
  28. hell
  29. hellacious
  30. hello
  31. hellbender
  32. hellbent
  33. hell-bent
  34. hellbox
  35. hellcat
  36. hellebore
  37. heller
  38. hell-for-leather
  39. hellgrammite
  40.  
  41. etc.
  42.  
  43. The one-way hash function is a small series of mathematical steps 
  44. that makes a series of characters which is saved in the passwd file.
  45. The one-way hash function UNIX uses is a variant of Crypt(3).  The reason 
  46. that a dictionary file is needed is the fact that the Crypt(3) function 
  47. cannot be reversed, hence the name one-way hash.  It is mathematically
  48. infeasible to find in any amount of time the string of characters from 
  49. which the hash value came.
  50.  
  51. The passwd file is a series of lines, each with user info on it.  An
  52. example is:
  53.  
  54. joeschmoe:naVwowMManasMMo:10:200:Joe Schmoe:/users/joeschmoe:/bin/bash
  55.     ^           ^         ^   ^       ^            ^            ^
  56.     |           |         |   |       |            |            +- User's
  57.     |           |         |   |       |            |            shell program
  58.     |           |         |   |       |            +---- User's home directory
  59.     |           |         |   |       +----------------- User's real name
  60.     |           |         |   +------------------------- User number
  61.     |           |         +----------------------------- User's group number
  62.     |           +--------------------------------------- Hash of user's password
  63.     +--------------------------------------------------- Username
  64.  
  65. I will explain each of these:
  66.  
  67. -  Username is the name under which the user logs in.  Usually this is
  68.    accomplished by typing in the username at the username prompt and then
  69.    the password at the password prompt.
  70.  
  71. -  Hash of user's password is the target of the cracking method.  This is
  72.    what the hash of each word in the dictionary file is compared to.
  73.  
  74. -  User's group number determines things such as access to certain files,
  75.    etc.  Used more in the exploit technique
  76.  
  77. -  User's number is basically identification for the system.
  78.  
  79. -  User's real name is the name the user entered.  Not used by the system,
  80.    but it provides a handy human-readable id of each user.
  81.  
  82. -  User's home directory is the directory that they go to when they log
  83.    into the system.  
  84.  
  85. -  User's shell is the user interface that the user uses.  Shells include
  86.    /bin/bash /bin/ash /bin/tcsh /bin/csh and /bin/sh 
  87.  
  88. It is not necessary to modify the passwd file to contain only the passwords
  89. because most cracking programs look for the second field, which is indicated
  90. by the colon (:) seperating it from the username.
  91.  
  92. As you can see, it is also possible that, if the user's password is not
  93. in the dictionary file, the cracker won't find the password to that
  94. username.  However, on a system of 200 users, at least 70 of them will
  95. usually have passwords that are in dictionaries, depending on if the
  96. system administrator checks the passwords or not and the type of user
  97. that accesses the system most.  A server used by computer security experts
  98. will not be nearly as susceptible to this kind of an attack (or any, for
  99. that matter) as one which is used by average people for e-mail and internet 
  100. access.
  101.  
  102. The second kind of attack, the exploit, is a more difficult one, but it
  103. usually has greater rewards, including the possiblity of getting total
  104. control of the system.  Exploits work by using a piece of software in 
  105. such a way as to compromise the security of the system.  One of the most
  106. popular programs to use in this way is sendmail.  Sendmail is most 
  107. susceptible because it must be open to public access to allow mail to be 
  108. transferred into and out of the system.  Usually a buffer, an area in 
  109. memory where the system stores program information, is overwritten using 
  110. sendmail.  The experienced hacker can transfer his own program code into 
  111. the buffer so that while the system thinks it is simply running the mail 
  112. retriever it is actually copying a shell program into a public access 
  113. directory and giving it superuser privlidges.  Another type of exploit 
  114. involves causing a program which has superuser prividges to change your 
  115. group ID to 1, root, which effectively makes you the administrator of 
  116. the system.
  117.  
  118. Most of the time, these two types of attacks are used together.  The hacker 
  119. will first get a login with brute force to gain access to the outer level of 
  120. the system, and then from there use an exploit of some kind to gain root 
  121. priviledges.  After attaining root access, the hacker will install one or more 
  122. 'back doors' to allow himself access to the system again.  A very common one
  123. is taking the source code of the login program and modifying it to accept 
  124. a certain password for any user, as well as the user's own password.
  125.  
  126. An example of a function in C that could do this would be:
  127.  
  128. check_backdoor(entry,access)
  129. {
  130. /* the variable entry is the password that the user entered
  131.  * the variable access determines whether or not to allow the 
  132.  */  user into the system.  If access = 1 then the user is let in.
  133.  
  134. if (entry == "mybackdoor")
  135. {
  136. access = 1;
  137. return;
  138. }
  139.  
  140. cryptcheck(entry,access);
  141.  
  142. return;
  143. }
  144.  
  145. In this example, mybackdoor would be the password that could be used on
  146. any user account.  If mybackdoor was not the entry, then the password
  147. is hashed and checked against the password in /etc/passwd which allows
  148. the back door to function without being noticed by anyone, including the
  149. administrator.
  150.  
  151. I hope this information hhas been helpful in teaching you about the basis
  152. of hacking.  For more information, visit my home page or drop me an e-mail.
  153.  
  154. KwAnTAM_PoZeEtroN
  155. Leader of the Black Angels
  156. Ringmaster of the Ruiners Webring
  157. Head of Psychotic security
  158. http://kwantam.home.ml.org
  159. kwantam@mailhost.net
  160.  
  161.  
  162.